/*eslint-disable */
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import BlogIndex from '../views/BlogIndex.vue'
import MyBlog from '../views/MyBlog.vue'
import CreateBlog from '../views/CreateBlog.vue'
import BlogContext from '../views/BlogContext.vue'
import SearchBlog from '@/views/SearchBlog.vue'
import EditBlog from '@/views/EditBlog.vue'
import AdminBlogIndex from '@/views/admin/AdminBlogIndex.vue'
import AdminSearchBlog from '@/views/admin/AdminSearchBlog.vue'
import AdminSeeBlog from '@/views/admin/AdminSeeBlog.vue'
import AdminPassBlog from '@/views/admin/AdminPassBlog.vue'
import App from '@/App.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'home',
    redirect:'index'
  },
  {
  path: '/index',
  name: 'index',
  component: BlogIndex
  },
  {
    path: '/myblog',
    name: 'myblog',
    component:MyBlog
  },
  {
    path: '/createblog',
    name: 'createblog',
    component:CreateBlog
  },
  {
    path: '/editblog',
    name: 'editblog',
    component:EditBlog
  },
  {
    path: '/blog',
    name: 'blog',
    component:BlogContext
  },
  {
    path: '/search',
    name: 'search',
    component:SearchBlog
  },
  {
    path: '/adminIndex',
    name: 'adminIndex',
    component: AdminBlogIndex
  },
  {
    path: '/adminSearch',
    name: 'adminSearch',
    component:AdminSearchBlog
  },
  {
    path: '/adminSeeBlog',
    name: 'adminSeeBlog',
    component:AdminSeeBlog
  },
  {
    path: '/passBlog',
    name: 'passBlog',
   component:AdminPassBlog
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})


// router.afterEach((to, from, next) => {
//   // if (to.path === '/login') next();
//   // else {
    
//   //   if (token === null || token === '') {
//   //     next('/login');
//   //   }
//   //   else {
//   //     next();
//   //   }
//   // }
//   let token = localStorage.getItem('token');
// })

export default router
